home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
051-075
/
disk_075
/
copy
/
cp.doc
< prev
next >
Wrap
Text File
|
1992-05-06
|
3KB
|
69 lines
Cp - a replacement for AmigaDos Copy that retains the date.
by Jeff Lydiatt
Vancouver, Canada
Release 1.0, May 17, 1987
Cp and the c source is freely redistributable for personal
non-commercial use. Commercial rights are reserved by the
author. Feel free to make any modifications or use any
of the modules in other programs. I encourage you to do so
and hope you will release the code so others can learn by it.
Cp has most of the features of the AmigaDos copy command:
--------------------------------------------------------
o Cp supports the AmigaDos style pattern matching in the "from" name.
o Cp supports the All option.
o Cp supports the optional "from" and "to" qualifiers for file names.
o Cp will copy directories
Cp has a number of features not found in AmigaDos copy:
-------------------------------------------------------
o Cp will retain the date of the copied file.
o Cp uses a 32000 byte buffer, which speeds copies when the from and
to file is on the same disk.
o You may specify the current directory by a "to" name of ".". For
example if your current directory is "Df0:",
"cp ram:x ."
will copy the file called x in your ram: disk to "df0:x".
o Cp will also create the "to" file for you if you use the "All"
option. For example if "x" is a directory,
"cp from x to y"
will create a directory called "y", and will copy all the files in
x to the newly created "y" directory.
About the AmigaDos-style pattern matching.
-----------------------------------------
Cp uses a compact function for regular expression pattern matching.
The algorithm was taken from a paper by Martin Richards, that was
published in the September 1979 issue of "Software, Practice and
Experience". Professor Richards published his example in BCPL, and
I have (sucessfully I think) translated it to C. It's interesting to
note that I translated it verbatim, with no special modifications to
adapt it to AmigaDos conventions.
Cp recognises a number of special characters with special meanings,
which can be used to recognise any other charcaters that match them.
? Matches any single character.
% Matches the null character.
#<p> Matches zero or more occurrences of the pattern <p>
<p1>|<p2> Matches either pattern <p1> or <p2>.
() Can be used to group expressions together.
'# Can be used to turn off the special meaning of the special
characters #, ?, %, |, (, ), or '.
Some examples will help to make this clearer.
cp a|b . copies a or b to the current directory.
cp a#bc . copies ac abc abbc.
cp a#(b|c)d . copies ad abd abcd.
cp a?b . copies axb ayb aab.
cp a#?b copies ab axxb ax.ab.
cp '?#?'# . copies ?# ?ab# ??##.
cp a(b|%)#c . copies a abc accc.